package yf.mall.enums.app;

import lombok.Getter;

import java.util.Arrays;


/**
 * 
 *
 * @date Sat Aug 12 22:43:05 CST 2023
 */
@Getter
public enum AppCoursePurchaseActiveStatusEnum {


    NO(0, "未激活"),


    YES(1, "已激活");


    int index;
    String value;

    public static String[] names() {
        return Arrays.stream(AppCoursePurchaseActiveStatusEnum.values()).map(m -> m.getValue()).toArray(String[]::new);
    }

    AppCoursePurchaseActiveStatusEnum(int index, String value) {
        this.index = index;
        this.value = value;
    }

    public static int nameOf(String name) {
        Integer res = null;
        for (int i = 0; i < names().length; i++) {
            if (names()[i].equals(name)) {
                res = i;
                break;
            }
        }
        return res;
    }

    public static String indexOf(int idx) {
        return AppCoursePurchaseActiveStatusEnum.values()[idx].getValue();
    }

}
